from qiniu import Auth,put_data
# 配置秘钥
AK = '0ULjxrRYQOGsOkTM_jDlBQZTIb_i-l8NRGUV-FWL'
SK = 'dDhd8B5PvHKzvS4JfHzYXelgUQDgzVMzABgCYnwQ'
# 域名
damain = 'http://q5u1664yz.bkt.clouddn.com/'
# 空间名
bucket_name = 'icewky'


def sto(file):
    '''七牛接口'''
    # 鉴权
    q = Auth(AK,SK)
    # token
    token = q.upload_token(bucket_name)

    res,info = put_data(token,None,file)

    if info.status_code == 200:
        print('七牛接口：上传成功')
    return damain + res['key']
if __name__ == '__main__':
    with open('123.jpg','rb') as f:
        print(sto(f.read()))